<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script src="vue.js"></script>
<script src="vue-router.js"></script>
<body>
    <div id="app">
        <router-view></router-view>
        <router-view name="login"></router-view>
        <router-view name="reg"></router-view>
    </div>
    <script>
        var home={
            template:'<h1>home组件</h1>'
        };
        var login={
            template:'<h1>login组件</h1>'
        };
        var reg={
            template:'<h1>reg组件</h1>'
        };
        const router = new VueRouter({
            routes:[
                {path:'/',components:{
                    default:home, 
                    //default就是默认值的意思，他表示这个路由匹配规则如果没有指定模板视图的名字,就以这个组件来填充
                    
                    login:login,
                    reg:reg
                }},
              
            ]
        })

        var vm = new Vue({
            el:'#app',
            router:router,
        })
    </script>
</body>
</html>